package com.zwt.service.impl;

import com.zwt.dao.TsPlatformUserMapper;
import com.zwt.domain.TsPlatformUser;
import com.zwt.domain.TsPlatformUserExample;
import com.zwt.service.TsPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zwt on 2018/8/24.
 */
@Service
public class TsPlatformServiceImpl implements TsPlatformService{

    @Autowired
    private TsPlatformUserMapper tsPlatformUserMapper;

    @Override
    public TsPlatformUser selectById(Long id) {
        return tsPlatformUserMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TsPlatformUser> queryAll() {
        TsPlatformUserExample tsPlatformUserExample = new TsPlatformUserExample();
        List<TsPlatformUser> tsPlatformUserList = tsPlatformUserMapper.selectByExample(tsPlatformUserExample);
        return tsPlatformUserList;
    }

    @Override
    public TsPlatformUser selectByMoblie(String moblie) {
        TsPlatformUserExample tsPlatformUserExample = new TsPlatformUserExample();
        TsPlatformUserExample.Criteria criteria = tsPlatformUserExample.createCriteria();
        criteria.andMobileEqualTo(moblie);
        criteria.andSourceEqualTo((byte) 1);
        List<TsPlatformUser> tsPlatformUserList = tsPlatformUserMapper.selectByExample(tsPlatformUserExample);
        return tsPlatformUserList.get(0);
    }


}
